$(function() {
	var current = {
		initView: function() {
			//获取id
			var obj = global.getUrlParam(window.location.href);
			//发送请求
			var url, param;
			if(obj.type == 'play'){
				url = global.ctx + global.playDetailUrl;
				param = {'storeId': obj.id};
			} else {
				url = global.ctx + global.storeDetailUrl;
				param = {'beautyId': obj.id};
			}
			global.getDataRequest('POST', 'jsonp', url, param, function(json) {
				console.log(json);
				//轮播图
				var imgArr = json.data.imgList;
				$('#swiper_wrapper_js').empty();
				for(var i = 0; i < imgArr.length; i++) {
					$('#swiper_wrapper_js').append('<a class="swiper-slide"><img src="' + imgArr[i].pictureUrl + '"/></a>');
				}
				var mySwiper = new Swiper('.swiper-container', {
					autoplay: 3000,
					direction: 'horizontal',
					loop: true,
					pagination: '.swiper-pagination',
				});
				//店铺详情
				var detail = json.data.info;
				if(obj.type == 'play'){
					var name = detail.storeName;
				} else {
					var name = detail.name;
				}
				$('#store_name_js').html(name);
				$('#store_tel_js').html(detail.contactPhone).attr('href', 'tel:'+detail.contactPhone);
				$('#store_add_js').html(detail.address);
				document.title = name;
				//店铺介绍
				$('body').append(detail.content);
			});
		},
	};

	current.initView();
});